import {fromJS} from 'immutable'
import {actionTypes} from './index'
import * as constant from '@/config/constant'

const defaultState = fromJS({
    wanPort: '',
    formData:{
        enabled: 0
    },
    param:{},
    connectTypeValueForWeb:0,
    pppoeValidate: false,
    staticIpValidate: false,
    dhcpValidate: false,
})


export default (state = defaultState, action)=>{
    switch(action.type){
        case actionTypes.UPDATE_LIST_DATA:
            return state.merge(fromJS(action.value))
        case actionTypes.SET_WAN_PORT:
            return state.set('wanPort',action.value)
        case actionTypes.CHANGE_FORM_DATA:
            console.log('action.value',fromJS(action.value))
            return state.set('formData',fromJS(action.value))
        default:
            return state
    }
}
